﻿@page "/"
@namespace SwashbucklerDiary.Rcl.Pages
@inherits DiariesPageComponentBase

<MyAppBar>
    <MyTabs @bind-Value="tab"
                  Items="tabNames">
    </MyTabs>

    <MSpacer></MSpacer>

    <MultiSearch OnSearch="Search"></MultiSearch>
</MyAppBar>

<SwiperTabItems @ref="swiperTabItems"
                @bind-Value="tab">
    <SwiperTabItem>
        <MContainer Class="my-container"
                    Fluid="true">
            <div class="pl-2">
                @if (showDate)
                {
                    <div class="text--secondary mb-2">
                        @(DateTime.Now.ToString("d") + " " + I18n.ToWeek())
                    </div>
                }

                @if (showWelcomeText)
                {
                    <div class="text-h6 mb-5">
                        @GetWelcomeText()
                    </div>
                }

            </div>

            <DiaryCardList @bind-Tags="Tags"
                           Value="Diaries">
            </DiaryCardList>
        </MContainer>

    </SwiperTabItem>
    <SwiperTabItem>
        <MContainer Class="my-container"
                    Fluid="true">
            <TagCardList @bind-Value="Tags"
                         Diaries="Diaries">

            </TagCardList>
        </MContainer>
    </SwiperTabItem>
</SwiperTabItems>

<MWindow Value="tab" Style="height:0;z-index:1;">
    <MWindowItem Transition="">
        <RightBottomFloatButton Icon="mdi-pencil"
                                OnClick="@(()=>To("write"))">
        </RightBottomFloatButton>
    </MWindowItem>
    <MWindowItem Transition="">
        <RightBottomFloatButton Icon="mdi-plus"
                                OnClick="()=>ShowAddTag=true">
        </RightBottomFloatButton>
    </MWindowItem>
</MWindow>

<InputDialog @bind-Visible="ShowAddTag"
             Title="@(I18n.T("Tag.Add"))"
             Placeholder="@(I18n.T("Tag.Placeholder"))"
             OnOK="SaveAddTag">
</InputDialog>